import java.io.*;

public class Demo13 {
    public static void main(String[] args) {
        try(InputStream inputStream = new FileInputStream("C:\\Users\\LEGION\\Desktop\\test\\Lucy.png");
            OutputStream outputStream = new FileOutputStream("C:\\Users\\LEGION\\Desktop\\test\\Lucy2.png")){
            byte[] buf = new byte[1024];
            while(true){
                int n = inputStream.read(buf);
                if(n == -1){
                    break;
                }
                outputStream.write(n);
                outputStream.flush();
            }
        }catch(IOException e ){
            e.printStackTrace();
        }
    }
}
